package com.artieksi.entity.rowmapper;

import com.artieksi.entity.Sign;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * User: TTACANSEVER
 */
public class SignRowMapper implements ParameterizedRowMapper<Sign> {
    @Override
    public Sign mapRow(ResultSet rs, int i) throws SQLException {
        Sign sign = new Sign();
        sign.setId(rs.getInt("id"));
        sign.setSignerId(rs.getInt("signer_id"));
        sign.setSignedId(rs.getInt("signed_id"));
        sign.setSignerUsername(rs.getString("signer_username"));
        sign.setSignedUsername(rs.getString("signed_username"));
        sign.setSign(rs.getString("sign"));
        sign.setSignTime(rs.getTimestamp("sign_time"));
        sign.setLatitude(rs.getDouble("latitude"));
        sign.setLongitude(rs.getDouble("longitude"));
        return sign;
    }
}
